<!DOCTYPE html><html lang="en"><head><title>GetRefund.aspx</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content=""><meta name="groc-document-path" content="GetRefund.aspx"><meta name="groc-project-path" content="GetRefund.aspx.cs"><link rel="stylesheet" type="text/css" media="all" href="assets/style.css"><script type="text/javascript" src="assets/behavior.js"></script><body><div id="meta"><div class="file-path">GetRefund.aspx.cs</div></div><div id="document"><div class="segment"><div class="comments "><div class="wrapper"><h1 id="get-details-of-a-refund">Get Details of a Refund</h1>
<p>This sample code demonstrates how you can retrieve 
details of refund.
API used: /v1/refund/{id}</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">using</span> System;
<span class="hljs-keyword">using</span> System.Web;
<span class="hljs-keyword">using</span> PayPal;
<span class="hljs-keyword">using</span> PayPal.Api;
<span class="hljs-keyword">using</span> Newtonsoft.Json.Linq;
<span class="hljs-keyword">using</span> Newtonsoft.Json;

namespace PayPal.Sample
{
    <span class="hljs-keyword">public</span> <span class="hljs-keyword">partial</span> <span class="hljs-keyword">class</span> GetRefund : BaseSamplePage
    {
        <span class="hljs-keyword">protected</span> <span class="hljs-keyword">override</span> <span class="hljs-keyword">void</span> <span class="hljs-title">RunSample</span>()
        {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="api-context">Api Context</h3>
<p>Pass in a <code>APIContext</code> object to authenticate 
the call and to send a unique request id 
(that ensures idempotency). The SDK generates
a request id if you do not pass one explicitly. 
See <a href="/Source/Configuration.html">Configuration.cs</a> to know more about APIContext.</p></div></div><div class="code"><div class="wrapper">            <span class="hljs-keyword">var</span> apiContext = Configuration.GetAPIContext();</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="refund">Refund</h3>
<p>Pass an APIContext and the ID of the refunded
transaction </p></div></div><div class="code"><div class="wrapper">            <span class="hljs-keyword">var</span> refundId = <span class="hljs-string">"7B165985YD577493B"</span>;

            <span class="hljs-preprocessor">#<span class="hljs-keyword">region</span> Track Workflow</span>
            <span class="hljs-comment">//--------------------</span>
            <span class="hljs-keyword">this</span>.flow.AddNewRequest(<span class="hljs-string">"Get refund details"</span>, description: <span class="hljs-string">"ID: "</span> + refundId);
            <span class="hljs-comment">//--------------------</span>
            <span class="hljs-preprocessor">#<span class="hljs-keyword">endregion</span></span>

            <span class="hljs-keyword">var</span> refund = Refund.Get(apiContext, refundId);

            <span class="hljs-preprocessor">#<span class="hljs-keyword">region</span> Track Workflow</span>
            <span class="hljs-comment">//--------------------</span>
            <span class="hljs-keyword">this</span>.flow.RecordResponse(refund);
            <span class="hljs-comment">//--------------------</span>
            <span class="hljs-preprocessor">#<span class="hljs-keyword">endregion</span></span>
        }
    }
}</div></div></div></div></body></html>